home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / doom / axxwar_1.zip / SOURCES / THROWAXE.QC < prev    next >
Text File  |  1997-02-27  |  3KB  |  104 lines

  1. // AxxWars 0.8
  2.  
  3. void (float damage) spawn_touchblood;
  4. void (vector org, vector vel) SpawnChunk;
  5.  
  6. /*
  7. ========
  8. Axetouch
  9. ========
  10. */
  11. void() AxeTouch =
  12. {
  13.         local   float   clink;
  14.         local   entity  stemp;
  15.  
  16.         if (other == self.owner && self.num_bounces == 0)
  17.                 return;
  18.         self.avelocity = '300 300 300';
  19.         self.movetype = MOVETYPE_BOUNCE;
  20.         setsize (self, '-1 -2 -3' , '1 2 3');
  21.  
  22.         if (other.classname == "player" && self.velocity == '0 0 0')
  23.             {
  24.         if (other.num_axes >= 20)
  25.             return;
  26.         else
  27.                  sound (other, CHAN_ITEM, "weapons/pkup.wav", 1, ATTN_NORM);
  28.                  sprint(other,"You Got A Throwing Axe!\n");
  29.                     other.num_axes = other.num_axes + 1;
  30.                     stemp = self;
  31.                     self = other;
  32.                     W_SetCurrentAmmo();
  33.                     self = stemp;
  34.                     remove(self);
  35.             }
  36.         if (other.takedamage && self.velocity != '0 0 0')
  37.             {
  38.              if (self.num_bounces == 0)
  39.                  {
  40.                    spawn_touchblood (40);
  41.                    SpawnChunk (self.origin,self.velocity);
  42.                    other.punchangle_x = -20;
  43.                    self.velocity = self.velocity * -0.1;
  44.                    self.avelocity = '0 0 0';
  45.                    other.axhitme = 1;
  46.                    T_Damage (other, self, self.owner, 40);
  47.                     }
  48.         else
  49.                 {
  50.                         other.punchangle_x = -10;
  51.                         spawn_touchblood (15);
  52.                         self.velocity = self.velocity * -0.1;
  53.                         self.avelocity = '0 0 0';
  54.                         other.axhitme = 1;
  55.                         T_Damage (other, self, self.owner, 8);
  56.                 }
  57.         }
  58.         else if (!other.takedamage)
  59.         {
  60.                 clink = random() * 2;
  61.                 if (clink <=1)
  62.                 sound (self, CHAN_WEAPON, "player/axhit2.wav", 1, ATTN_NORM);
  63.                 else
  64.                 sound (self, CHAN_WEAPON, "weapons/tink1.wav", 1, ATTN_NORM);
  65.         }
  66.         self.num_bounces = self.num_bounces + 1;
  67.         if (self.num_bounces > 22)
  68.                 SUB_Remove();
  69. };
  70.  
  71. /*
  72. ==========
  73. W_ThrowAxe
  74. ==========
  75. */
  76. void() W_ThrowAxe =
  77. {
  78.         local   entity missile;
  79.  
  80.         sound (self, CHAN_WEAPON, "weapons/woosh.wav", 1, ATTN_NORM);
  81.         self.punchangle_x = -6;
  82.       missile = spawn ();
  83.       missile.owner = self;
  84.         missile.movetype = MOVETYPE_FLYMISSILE;
  85.         missile.solid = SOLID_TRIGGER;
  86.         makevectors (self.v_angle);
  87.         missile.velocity = aim(self, 10000);
  88.         missile.angles = vectoangles(missile.velocity);
  89.         missile.velocity = missile.velocity * 600;
  90.         missile.touch = AxeTouch;
  91.         missile.classname = "throwaxe";
  92.       missile.nextthink = time + 600;
  93.         missile.think = SUB_Remove;
  94.         setmodel (missile, "progs/throwaxe.mdl");
  95.         setsize (missile, '0 0 0' , '0 0 0');
  96.         setorigin (missile, self.origin + v_forward*2 + '0 0 16');
  97.         missile.avelocity ='-500 0 0';
  98.         missile.num_bounces = 0;
  99.         self.num_axes = self.num_axes - 1;
  100.         self.currentammo = self.num_axes;
  101.         W_SetCurrentAmmo ();
  102. };
  103.  
  104.